using System;
using System.Collections.Generic;
using System.Text;

namespace Hermes.Framework.Implementation
{
    public class TxFileCreate : TxOperationTemplate, ITransactableCreate
    {
        public TxFileCreate(string fileName)
            : base(fileName)
        {

        }

        #region ITransactableCreate

        public void Create()
        {
            base.Execute(dstFileName);
        }

        #endregion

        protected override void Operate()
        {
            // this.fileSystem.Create(this.shadowFileName);
            this.fileSystem.CreateFile(this.dstFileName);
        }

        public override void Commit()
        {
//            this.fileSystem.Rename(this.shadowFileName, this.dstFileName);
        }

        public override void Rollback()
        {
            // this.fileSystem.Delete(this.shadowFileName);
            this.fileSystem.Delete(this.dstFileName);
        }
    }
}
